import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import pinia from './store'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import '@/styles/theme.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import { LineChart, PieChart as PieChartComponent, RealtimeChart } from '@/components/charts'
// 导入Element Plus中文语言包
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
// 导入主题管理器
import { themeManager } from '@/utils/theme'
// 导入DataV (暂时注释掉，使用自定义组件)
// import DataV from '@jiaminghi/data-view'

const app = createApp(App)

// 注册Element Plus图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

// 注册图表组件
app.component('LineChart', LineChart)
app.component('PieChartComponent', PieChartComponent)
app.component('RealtimeChart', RealtimeChart)

app.use(pinia)
app.use(router)
// app.use(DataV)
// 使用Element Plus并配置中文语言包
app.use(ElementPlus, {
  locale: zhCn,
})

// 初始化主题
themeManager.loadSavedSettings()

app.mount('#app')
